import Vue from 'vue'
import App from './App.vue'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import router from './router';
import 'normalize.css/normalize.css';
import VueClipboard from 'vue-clipboard2'
Vue.config.productionTip = false

Vue.use(ElementUI);
Vue.use(VueClipboard);

router.beforeEach((to, from, next) => {
  /* 路由发生变化修改页面meta */
  if(to.meta.content){
    console.log(22222)
    let head = document.getElementsByTagName('head');
    let meta = document.createElement('meta');
    document.querySelector('meta[name="keywords"]').setAttribute('content', to.meta.content.keywords)
    document.querySelector('meta[name="description"]').setAttribute('content', to.meta.content.description)
    meta.content = to.meta.content;
    head[0].appendChild(meta)
  }
  next()
})

new Vue({
  render: h => h(App),
  router,
}).$mount('#app')
